define(function (require) {
    var services = require('module/ServiceModule');
    services.factory('iptvService', function ($http, AUTH_EVENTS, Restangular) {
        return {
            userLogin: function (authenticationInfo) {
                ePart.log(Restangular);
                return $http({
                        method: 'JSONP',
                        url: 'http://192.168.0.108:8080/omnipresent/user/login.do',
                        params: {
                            username: authenticationInfo.userName,
                            password: authenticationInfo.passWord,
                            usertype: authenticationInfo.userType
                        },
                        responseType: 'json'
                    }
                )
            },
            getMenuRequest: function () {

                return $http.get('src/scripts/jsonData/mainMenuData.json', {
                    cache: true
                });
            },
            demo: function () {
                console.log(AUTH_EVENTS);
                return $http.get('https://api.douban.com/v2/movie/search?q=张艺谋', {cache: true});
            },
            queryFilm: function (name) {
                return $http.get('https://api.douban.com/v2/movie/search?q=' + name, {cache: true});
            },
            AuthService: function (credentials) {

            },
            recommendList: function () {
                return [{
                    title: '蝙蝠侠：黑暗骑士崛起',
                    imgUrl: $.i18n.image('6bf2d135-3b3e-4e19-964d-081cd940fde2.jpg'),
                    shortDec: $.i18n.text('placeholder_text'),
                    vodNumber: '000001'
                }, {
                    title: '盗梦空间',
                    imgUrl: $.i18n.image('50a4b887407fe.jpg'),
                    shortDec: $.i18n.text('placeholder_text'),
                    vodNumber: '000002'
                }, {
                    title: '敢死队2',
                    imgUrl: $.i18n.image('91f59eb6780a209858a8601605ca3f5a.jpg'),
                    shortDec: $.i18n.text('placeholder_text'),
                    vodNumber: '000003'
                }, {
                    title: '超凡蜘蛛侠2',
                    imgUrl: $.i18n.image('20140310112003975501.jpg'),
                    shortDec: $.i18n.text('placeholder_text'),
                    vodNumber: '000004'
                }, {
                    title: '蝙蝠侠：黑暗骑士',
                    imgUrl: $.i18n.image('darkknight_01.jpg'),
                    shortDec: $.i18n.text('part1'),
                    vodNumber: '000005'
                }]
            },
            queryVodDetailById: function (curVodId) {
                return {
                    info: 'this is vod info by id',
                    vodId: '2015',
                    poster: {
                        largeImage: 'https://img3.doubanio.com/view/photo/raw/public/p2323669236.jpg',
                        normalImage: '',
                        smallImage: ''
                    },
                    title: '冰与火之歌第六季',
                    alsoCalled: '星际启示录(港) / 星际效应(台) / 星际空间 / 星际之间 / 星际远航 / 星际 / Flora\'s Letter\'',
                    type: 'vod',
                    vodType: 'season',
                    genres: '魔幻 /犯罪 / 剧情',
                    duration: '110 分钟',
                    year: '2016.4(中国)',
                    comments: 5,
                    Dec: {
                        shortDesc: '近未来的地球黄沙遍野，小麦、秋葵等基础农作物相继因枯萎病灭绝，人类不再像从前那样仰望星空，放纵想象力和灵感的迸发，而是每日在沙尘暴的肆虐下倒数着所剩不多的光景。',
                        longDesc: '近未来的地球黄沙遍野，小麦、秋葵等基础农作物相继因枯萎病灭绝，人类不再像从前那样仰望星空，放纵想象力和灵感的迸发，而是每日在沙尘暴的肆虐下倒数着所剩不多的光景。在家务农的前NASA宇航员库珀（马修·麦康纳 Matthew McConaughey 饰）接连在女儿墨菲（麦肯吉·弗依 Mackenzie Foy 饰）的书房发现奇怪的重力场现象，随即得知在某个未知区域内前NASA成员仍秘密进行一个拯救人类的计划。多年以前土星附近出现神秘虫洞，NASA借机将数名宇航员派遣到遥远的星系寻找适合居住的星球。在布兰德教授（迈克尔·凯恩 Michael Caine 饰）的劝说下，库珀忍痛告别了女儿，和其他三名专家教授女儿艾米莉亚·布兰德（安妮·海瑟薇 Anne Hathaway 饰）、罗米利（大卫·吉雅西 David Gyasi 饰）、多伊尔（韦斯·本特利 Wes Bentley 饰）搭乘宇宙飞船前往目前已知的最有希望的三颗星球考察。他们穿越遥远的星系银河，感受了一小时七年光阴的沧海桑田，窥见了未知星球和黑洞的壮伟与神秘。在浩瀚宇宙的绝望而孤独角落，总有一份超越了时空的笃定情怀将他们紧紧相连……'
                    },
                    videoQuality: 1,
                    filmLanguage: '英文',
                    productionArea: '美国 / 英国 / 加拿大',
                    performer: '111,222,333,4444,555,666,777,888,999,000',
                    'direction': '克里斯托弗`诺兰'

                }
            },
            getAllMenuList: function () {
                var dfd = new $.Deferred();
                dfd.resolve({
                    info: 'This is a whole menu of data',
                    menuList: [{
                        title: $.i18n.text('homeMenu'),
                        stateName: 'index.Home',
                        stateUrl: 'ioHome',
                        isShow: true,
                        subMenuList: [{
                            subTitle: '本部推荐',
                            subUrl: '#',
                            subStateName: 'index.Vod'
                        }, {
                            subTitle: '实时信息',
                            subUrl: '#',
                            subStateName: 'index.Live'
                        }, {
                            subTitle: '新片预告',
                            subUrl: '#',
                            subStateName: 'index.Person'
                        }]
                    }, {
                        title: $.i18n.text('vod'),
                        stateName: 'index.Vod',
                        stateUrl: 'ioVod',
                        isShow: true,
                        subMenuList: [{
                            subTitle: '电视剧',
                            subUrl: '#',
                            subStateName: '#'
                        }, {
                            subTitle: 'IO电影',
                            subUrl: '#',
                            subStateName: '#'
                        }, {
                            subTitle: '电视综艺',
                            subUrl: '#',
                            subStateName: '#'
                        }]
                    }, {
                        title: $.i18n.text('kids'),
                        stateName: 'index.Kid',
                        stateUrl: 'ioKid',
                        isShow: true,
                        subMenuList: [{
                            subTitle: 'IO教育',
                            subUrl: '#',
                            subStateName: '#'
                        }, {
                            subTitle: 'IO电影',
                            subUrl: '#',
                            subStateName: '#'
                        }, {
                            subTitle: 'IO动画',
                            subUrl: '#',
                            subStateName: '#'
                        }]
                    }, {
                        title: $.i18n.text('myEnter'),
                        stateName: 'index.Person',
                        stateUrl: 'ioPerson',
                        isShow: true,
                        subMenuList: [{
                            subTitle: '观看历史',
                            subUrl: '#',
                            subStateName: '#'
                        }, {
                            subTitle: '下载',
                            subUrl: '#',
                            subStateName: '#'
                        }, {
                            subTitle: 'IO收藏',
                            subUrl: '#',
                            subStateName: '#'
                        }]
                    }]
                });
                return dfd
            },
            otherMenuList: function () {
                var dfd = new $.Deferred();
                dfd.resolve([{
                    subTitle: $.i18n.text('vod_title'),
                    subUrl: '#',
                    subStateName: 'index.Vod'
                }, {
                    subTitle: $.i18n.text('vod_title'),
                    subUrl: '#',
                    subStateName: 'index.Vod'
                }, {
                    subTitle: $.i18n.text('vod_title'),
                    subUrl: '#',
                    subStateName: 'index.Vod'
                }]);
                return dfd;
            },
            mySpaceMenuList: function () {
                var dfd = new $.Deferred();
                dfd.resolve([{
                    subTitle: $.i18n.text('homeMenu'),
                    subUrl: '#',
                    subStateName: 'index.Home'
                }, {
                    subTitle: $.i18n.text('vod'),
                    subUrl: '#',
                    subStateName: 'index.Vod'
                }, {
                    subTitle: $.i18n.text('kids'),
                    subUrl: '#',
                    subStateName: 'index.Kid'
                }, {
                    subTitle: $.i18n.text('myEnter'),
                    subUrl: '#',
                    subStateName: 'index.Person'
                }]);
                return dfd;
            }
        }
    });

});